package hspedu.learn.javabase.extendsImporve;

public class PloyParameter {
    public static void main(String[] args) {
        Worker tom = new Worker("tom",2500);
        Manager milan = new Manager("milan", 5000, 20000);
        PloyParameter ployParameter = new PloyParameter();
        ployParameter.showEmpAnnual(tom);
        ployParameter.showEmpAnnual(milan);

        ployParameter.testWork(tom);
        ployParameter.testWork(milan);

    }
    public void showEmpAnnual (Employee employee) {
//        System.out.println(employee.getName());
        System.out.println(employee.getAnnual());
    }
    public void testWork(Employee employee) {
        if (employee instanceof Worker){
            ((Worker) employee).work();
        }else if (employee instanceof Manager){
            ((Manager) employee).manage();
        }else {
            System.out.println("不做处理");
        }
    }

}
